<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="mydiv"></div>


    <script>
        var obj={
            id:1001,
            name:"alice",
            arrs:["吃饭","玩手机","打人"]
        };
        var p1=document.createElement("p");
        p1.innerHTML=obj.id;
        var p2=document.createElement("p");
        p2.innerHTML=obj.name;
        var li=document.createElement("li");
        for(var i=0;i<obj.arrs.length;i++){
            var span=document.createElement("span");
            span.innerHTML=obj.arrs[i];
            li.appendChild(span);
        }
        var div=document.querySelector("div");
        div.appendChild(p1);
        div.appendChild(p2);
        div.appendChild(li);
    </script>
</body>
</html>